package com.itheima.health.dao;

import com.itheima.health.pojo.Member;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface MemberMapper extends Mapper<Member> {
    @Select("select count(id) from t_member where regTime <= #{endTime}")
    Integer count(@Param("endTime") String endTime);

    @Select("select count(id) from t_member")
    Integer getTotalCount();

    @Select("select count(id) from t_member where regTime between #{startTime} and #{endTime}")
    Integer countRangRegtime(@Param("startTime") String startTime, @Param("endTime") String endTime);

    int add(Member member);

    List<Map<String, Object>> countBySex();

    List<Map<String,Object>> countByRegAge();

    /**
     * 查询日期之前的用户数量
     *
     * @param endDate
     * @return
     */
    @Select("select  count(1) from t_member where regTime<= #{endDate}")
    Long countByRegTimeBefore(@Param("endDate") String endDate);

}
